package com.ghh.service.impl;

import com.ghh.dao.UserDao;
import com.ghh.domain.User;
import com.ghh.service.UserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;


@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    public boolean save(User user) {
        int save = userDao.save(user);
        return save == 1;
    }

    @Override
    public PageInfo pageQuery(Integer page, Integer size) {
        PageHelper.startPage(page, size);
        List list = userDao.findAll();
        return new PageInfo(list);
    }
}
